<?php

namespace Api\Captcha\Yangbx;

use Yangbx\CaptchaLumen\Captcha;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

/**
 * 服务提供者
 */
class ServiceProvider extends BaseServiceProvider
{
    /**
     * Register any application services.
     * 服务注册时执行，此处仅可用于注册 Ioc 绑定
     * @return void
     */
    public function register()
    {
        // 注册配置文件
        config()->set('Captcha\Yangbx', require __DIR__.'/config.php');

        // Ioc 绑定
        $this->app->bind('Api\Captcha\CaptchaRepository', function ($app) {
            $captcha = new Captcha (
                $app['Illuminate\Filesystem\Filesystem'],
                $app['Illuminate\Config\Repository'],
                $app['Intervention\Image\ImageManager'],
                $app['Illuminate\Hashing\BcryptHasher'],
                $app['Illuminate\Support\Str']
            );
            return new YangbxRepository($captcha);
        });
    }

}
